package com.baizhi.controller;

import com.baizhi.entity.Product;
import com.baizhi.feignclient.ProductClient;
import lombok.extern.slf4j.Slf4j;
import org.nutz.json.Json;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

@RestController
@Slf4j
public class CategoryController {

    @Value("${server.port}")
    private int port;

    @Resource
    private ProductClient productClient;

    @GetMapping("/category")
    public String category() {
//        String product = productClient.product();
//        String list = productClient.list();
//        log.info(list);
//        String result = productClient.test("小陈", 23);
//        String result = productClient.test1(21, "小杨");
//        String result = productClient.test2(new Product(1, "超短裙", 23.23, new Date()));

//        String result = productClient.test4(new String[]{"杨琛", "宇飞", "腻味"});
//        Product product = productClient.product(21);
        List<Product> byCategoryId = productClient.findByCategoryId(12);
        return Json.toJson(byCategoryId);
    }
}
